

project(widgets)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC OFF)

find_package(Qt5 COMPONENTS Widgets Core PrintSupport)

file(GLOB_RECURSE  SRCS CONFIGURE_DEPENDS ./*.cpp)
source_group_by_dir(SRCS)

add_library(${PROJECT_NAME} SHARED
     ${SRCS}
     res/widgets.qrc
)

target_compile_options(${PROJECT_NAME} PRIVATE -DS_WIDGETS_DLL)
target_link_libraries(${PROJECT_NAME} Qt::Widgets Qt::PrintSupport)
target_link_libraries(${PROJECT_NAME} core)

if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
target_link_libraries(${PROJECT_NAME} "-Wl,--no-as-needed ${QCEFVIEW_DIR}/${CMAKE_BUILD_TYPE}/libcef.so")
target_link_libraries(${PROJECT_NAME} QCefView)
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
target_link_libraries(${PROJECT_NAME} QCefView${CMAKE_OSX_ARCHITECTURES})
else()
target_link_libraries(${PROJECT_NAME} QCefView)
endif()
